package com.example.demo;

import com.jgdt.tools.decrypt.rest.Rest;

/**
 * <p>
 *
 * </p>
 *
 * @author chang.zhou
 * @version $
 * @date Created in 2021/6/3 15:05
 */
public class RestBody<T> implements Rest<T> {

    private int code;
    private String message;
    private T data;

    public RestBody(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static RestBody ok(){
        return new RestBody(1,"操作成功", null);
    }

    public static RestBody ok(Object data){
        return new RestBody(1,"操作成功", data);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public T getData() {
        return data;
    }

    @Override
    public void setData(T data) {
        this.data = data;
    }
}
